package homework_01.home_01;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Jdbc {
    public static void main(String[] args) {
        String sql = "INSERT INTO user(name,pwd,email,birthday)\n" +
                "VALUES('张三','888888','zhangsan@126.com','1986-10-11'),\n" +
                "('李四','999999','lisi@126.com','1988-10-23'),\n" +
                "('王五','777777','wangwu@126.com','1990-9-11')";
        sql = "UPDATE user\n" +
                "SET birthday = NOW()\n" +
                "WHERE name ='张三'";
        sql="DELETE FROM `user`\n" +
                "WHERE name = '李四'";

        UserDao user = new UserDao();
        int r = user.executeUpdate(sql);
        if(r>0){
            System.out.println("成功，受影响的行为："+r);
        }else {
            System.out.println("执行失败");
        }
    }
}
